package com.example.wilson.lession;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class RecyclerViewActivity extends AppCompatActivity {

    private List<Imagetext> imagetextList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycler_view);

        init();
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycle_view);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        //layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);

        //recyclerView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.HORIZONTAL));
        recyclerView.setLayoutManager(layoutManager);
        RecyclerViewAdapter adapter = new RecyclerViewAdapter(imagetextList);
        recyclerView.setAdapter(adapter);

    }

    private void init(){
        for(int i=0;i<7;i++){
            Imagetext a =new Imagetext("aa", R.mipmap.ic_launcher);
            Imagetext b =new Imagetext("bb", R.mipmap.ic_launcher);
            Imagetext c =new Imagetext("cc", R.mipmap.ic_launcher);
            Imagetext d =new Imagetext("dd", R.mipmap.ic_launcher);
            Imagetext e =new Imagetext("ee", R.mipmap.ic_launcher);
            Imagetext f =new Imagetext("ff", R.mipmap.ic_launcher);
            Imagetext g =new Imagetext("gg ", R.mipmap.ic_launcher);
            imagetextList.add(a);
            imagetextList.add(b);
            imagetextList.add(c);
            imagetextList.add(d);
            imagetextList.add(e);
            imagetextList.add(f);
            imagetextList.add(g);
        }
    }
}
